package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.AppZdDept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppZdDoctor;

@Mapper
public interface AppZdDoctorDao {

    @Select("select * from app_zd_doctor t where t.id = #{id}")
    AppZdDoctor getById(Long id);

    @Delete("delete from app_zd_doctor where id = #{id}")
    int delete(Long id);

    int update(AppZdDoctor appZdDoctor);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_zd_doctor(hostcode, code, doctorname, deptcode1, deptcode2, sex, title, price, specialty, qdcode, lycode) values(#{hostcode}, #{code}, #{doctorname}, #{deptcode1}, #{deptcode2}, #{sex}, #{title}, #{price}, #{specialty}, #{qdcode}, #{lycode})")
    int save(AppZdDoctor appZdDoctor);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppZdDoctor> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    @Select("select * from app_zd_doctor t where t.hostcode = #{hostcode} or  t.deptcode1 = #{deptcode1} or  t.deptcode2 = #{deptcode2} ")
    List<AppZdDoctor> getBylist(@Param("hostcode") String hostcode,@Param("deptcode1") String deptcode1,@Param("deptcode2") String deptcode2);
}
